<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="sec"	uri="http://www.springframework.org/security/tags"%>
<script>
	jQuery(document).ready(function() {
		jQuery("#newparametreModele-creation_form").validationEngine();
		$("#msg").text("Entier");
		$("#param").change(function() {
		    if($(this).find("option:selected").attr("class")== "Date"){
		    	$("#msg").text("Date format: yyyy-mm-dd");
		    }else{
		    	$("#msg").text("Entier");
		    }
		});
	});
</script>
<h2>List des parametres:</h2>
<table class="adminlist" cellpadding="1">
	<thead>
		<tr>
			<th width="2%" class="title">#</th>
			<th  class="title">Service</th>
			<th  class="title">Nom</th>
			<th class="title">Valeur</th>
			<th class="title" nowrap="nowrap">Supp.</th>
			
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${modeleparaservlist}" var="mps">
			<tr class="row0">
				<td align="center">${mps.id}</td>
				<td align="center">${mps.idParServ.idService.nom}</td>
				<td align="center">${mps.idParServ.nom}</td>
				<td align="center">${mps.parametreValeur}</td>
				<sec:authorize ifAnyGranted="SUPER_ADMIN,ADMIN">
				<td align="center"><a href="deletemodeleparametreservice?idm=${id}&idp=${mps.id}"  onclick="return confirm('Etes-vous sure de supprimer ce parametre ?');"><img src='<c:url value="/images/icon_delete.gif"></c:url>'/></a></td>
				</sec:authorize>
			</tr>
		</c:forEach>
	</tbody>
</table>
<h2>Ajouter une valeur:</h2>
<form:form action="newparametreModele" method="post" id="newparametreModele-creation_form"
	modelAttribute="modeleParametre">
	<fieldset>
		<legend>
			<img src='<c:url value="/images/services.jpg"/>'>
		</legend>
		<label>Parametre : </label>
		<spring:bind path="idParServ">
				<select name="${status.expression}" id="param">
					<sec:authorize ifAnyGranted="SUPER_ADMIN,ADMIN">
					<c:forEach var="parasev" items="${paraservlist}">
					<option class="${parasev.type}" value="${parasev.id}">${parasev.idService.nom}-${parasev.nom}</option>
					</c:forEach>
				</sec:authorize>
				</select>
		</spring:bind>
		<label>Valeur : </label>
		<form:input id="valeur" type="text" size="33" path="parametreValeur" value=""
			class="validate[required]" /><span id="msg"></span>
		<input type="hidden" value="${id}" name="id"/>
		<br> <br> <input type="submit" value="Ajouter" />


	</fieldset>
</form:form>